package com.example.nfctagcommons.server;

import java.util.HashMap;
import java.util.List;

import android.app.Activity;

import com.example.nfctagcommons.classes.Guard;
import com.example.nfctagcommons.classes.PointCheck;
import com.example.nfctagcommons.classes.VigilancePoint;
import com.example.nfctagcommons.controllers.GuardsController;
import com.example.nfctagcommons.controllers.SystemController;
import com.example.nfctagcommons.controllers.VigilanceLocalController;
import com.example.nfctagcommons.controllers.VigilanceLocalCheckHistoryController;
import com.example.nfctagcommons.exceptions.ConnectivityException;

public class ServerConnector {
	//OPERATIONS WITH VIGILANCE LOCAL
	
	public static List<VigilancePoint> getVigilanceSetAsList(Activity activity, String guardId) throws ConnectivityException{
		return VigilanceLocalController.getVigilanceSetAsList(activity, guardId);
	}
	
	public static HashMap<String, VigilancePoint> getVigilanceSet(Activity activity, String guardId) throws ConnectivityException{
		return VigilanceLocalController.getVigilanceSet(activity, guardId);
	}

	public static List<VigilancePoint> getAllLocals(Activity activity) throws ConnectivityException {
		return VigilanceLocalController.getAllLocals(activity);
	}


	//OPERATIONS WITH GUARDS
	public static List<Guard> getAllGuards(Activity activity) throws ConnectivityException {
		return GuardsController.getAllGuards(activity);
	}
	
	public static Guard login(Activity activity, String deviceId, String userName, String guardPassword) throws ConnectivityException{
		return GuardsController.login(activity, deviceId, userName, guardPassword);
	}
	
	public static void logout(Activity activity, String deviceId) throws ConnectivityException{
		GuardsController.logout(activity, deviceId);
	}

	//OPERATIONS WITH VIGILANCE LOCAL HISTORY
	public static boolean setLocalChecked(Activity activity, String guardId, String localId, String checkComments, long time) throws ConnectivityException{
		return VigilanceLocalCheckHistoryController.setLocalChecked(activity, guardId, localId, checkComments, time);
	}
	public static List<PointCheck> getVigilanceLocalHistory(Activity activity, String deviceId) throws ConnectivityException{
		return VigilanceLocalCheckHistoryController.getVigilanceLocalHistory(activity, deviceId);
	}
	
	//MISCELANEOUS OPERATIONS
	public static long synchronizeTime(Activity activity) throws ConnectivityException{
		return SystemController.synchronizeTime(activity);
	}

}
